<template>
<view>
	<view class="header">充值记录</view>
	<view class="table">
		<table border="0" width="95%" cellspacing="0" cellpadding="0">
			<tr>
				<td>充值会员</td>
				<td>充值金额</td>
				<td>赠送代金券</td>
				<td>支付金额</td>
			</tr>
			<tr v-for="(item,index) in list" :key="index">
				<td>{{item.user_name}}</td>
				<td>{{item.pay_money}}</td>
				<td>{{item.give_money}}</td>
				<td>{{item.pay_money}}</td>
			</tr>
		</table>
	</view>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return {
			//oaRole 1:店长2:员工3:商户
			list:[],
			page:1,
			pageShow:true,
			member_id:0
		}
	},
	onLoad:function(e){
		this.member_id = e.id
		uni.showLoading({
		    title: '加载中'  
		});
		this.getList();
	},
	methods: {
		getList:function(){
		    var data = {
				page:this.page,
		        member_id:this.member_id,
		    }
		    var that = this
			request({
				url: 'manage/recharge/list',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					if(res.data.data.last_page <= that.page){
						that.pageShow = false
					}
					if(that.page == 1){
						that.list = res.data.data.data
					}else{
						var list = that.list
						that.list = list.concat(res.data.data.data)
					}
				},
			})
		},
		onReachBottom: function(){
			if(this.pageShow){
				 //当前不是最后一页可加载
				 this.page = this.page + 1
				 uni.showLoading()
				 this.getList();
			}
		}
	}
}
</script>
<style>
@import url("../css/member/recharge.css");
</style>